<?php

namespace App\Service\UserCenter\v1_3_3;

use App\Constants\BusinessCode;
use App\Model\Guild\GuildManage;
use App\Model\Message;
use App\Model\UserProfile;
use App\Service\BaseService;
use App\Service\ServiceTrait\GetUserInfoTrait;
use App\Service\ServiceTrait\GuildTrait;

/**
 * 我的功能入口
 */
class MyEntranceService extends BaseService
{
    use GetUserInfoTrait;

    /**
     * 操作用户的id
     * @var int
     */
    private $actionUserId;

    public function handle()
    {
        $this->actionUserId = $this->getUserId();
        $profile = $this->getUserInfo($this->actionUserId);

        $appId = $this->appId;
        //['type' => 'invite'],
        $ret['list'] = $profile->gender == 0 ?
            [
                ['type' => 'cost'], ['type' => 'account'], ['type' => 'identify'], ['type' => 'task'], ['type' => 'face'], ['type' => 'help'], ['type' => 'adolescent'], ['type' => 'setting']
            ] :
            [
                ['type' => 'account'], ['type' => 'identify'], ['type' => 'task'], ['type' => 'face'], ['type' => 'help'], ['type' => 'adolescent'], ['type' => 'setting']
            ];
        $channel = $this->request->input('channel', '');
        $version = $this->request->input('version', '');

//        if ($channel == 1002){
//            return $ret;
//        }
        $forbidEntrance = config('busi.forbidEntrance_invitation');
        //判断是否屏蔽邀请入口
        if (
        !((!empty($forbidEntrance) && isset($forbidEntrance[$channel]) && version_compare($version,$forbidEntrance[$channel],'=')) )
        ) {
            $ret['list'][] = ['type' => 'invite'];
        }


        return $ret;
    }

}
